<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id')->unique()->indes()->comment('用户id');
            $table->string('name')->unique()->indes();
            $table->string('password');
            $table->char('mobile',40)->unique()->indes()->comment('手机号码');
            $table->tinyInteger('mobilestatus')->default(0)->comment('手机号码是否验证');
            $table->tinyInteger('status')->default(0)->comment('判断用户是否已经删除');

            $table->tinyInteger('avatarstatus')->default(0)->comment('是否有头像');
            $table->tinyInteger('videophostatus')->default(0)->comment('视频认证状态');

            $table->unsignedInteger('regdate')->default(0)->comment('注册时间');
            $table->Integer('credits')->default(0)->comment('总积分');

            $table->tinyInteger('notifysound')->default(0)->comment('短消息醒声音');
            $table->smallInteger('newpm')->default(0)->comment('新短消息数量');

            $table->smallInteger('newprompt')->default(0)->comment('新提醒数目');


            $table->tinyInteger('accessmake')->default(0)->comment('标志');
            $table->tinyInteger('allowadmincp')->default(0)->comment('标志');
            $table->tinyInteger('onlyaccptfriendpm')->default(0)->comment('是否只接收好友短消息');

            $table->unsignedTinyInteger('wechatbind')->default(0)->comment('用户是否绑定微信');
            $table->unsignedTinyInteger('qqbind')->default(0)->comment('用户是否绑定QQ');

            $table->timestamp('last_actived_at')->nullable()->comment('最后活跃时间');; //最后活跃时间

            $table->string('avatar')->nullable()->comment('头像地址');
            $table->string('introduction')->nullable()->comment('个人签名');

            $table->rememberToken();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
